<!-- 工作台 -->
<template>
	<view class="work-container">
		<!-- 轮播图 -->
		<uni-swiper-dot class="uni-swiper-dot-box" :info="data" :current="current" field="content">
			<swiper class="swiper-box" :current="swiperDotIndex" @change="changeSwiper">
				<swiper-item v-for="(item, index) in data" :key="index">
					<view class="swiper-item" @click="clickBannerItem(item)">
						<image :src="item.image" mode="aspectFill" :draggable="false" />
					</view>
				</swiper-item>
			</swiper>
		</uni-swiper-dot>

		<!-- 宫格组件 -->
		<block v-for="(tabs,index) in getWorkTabs" :key="tabs.permissionCode + index">
			<!-- && tabs.permissionCode  -->
			<view class="content-item" v-if="tabs.isShow && tabs.children.length>0">
				<uni-section :title="tabs.title" type="line"></uni-section>
				<view class="grid-body">
					<uni-grid :column="column" :showBorder="false" @change="changeGrid">
						<block v-for="(item,index) in tabs.children" :key="item.permissionCode + index">
							<!-- item.permissionCode -->
							<uni-grid-item v-if="item.isShow">
								<view class="grid-item-box" @click="jumpFun(item.router)">
									<image style="height: 80rpx;width: 80rpx;" :src="item.icon" :alt="item.title" />
									<text class="text">{{item.title}}</text>
								</view>
							</uni-grid-item>
						</block>
					</uni-grid>
				</view>
			</view>
		</block>
		<!-- <view class="content-item">
			<uni-section title="销售合同" type="line"></uni-section>
			<view class="grid-body">
				<uni-grid :column="column" :showBorder="false" @change="changeGrid">
					<uni-grid-item>
						<view class="grid-item-box">
							<image style="height: 80rpx;width: 80rpx;" src="/static/images/icon/icon1.png" alt="" />
							<text class="text">合同录入</text>
						</view>
					</uni-grid-item>
				</uni-grid>
			</view>
		</view>

		<view class="content-item">
			<uni-section title="报销管理" type="line"></uni-section>
			<view class="grid-body">
				<uni-grid :column="column" :showBorder="false" @change="changeGrid">
					<uni-grid-item>
						<view class="grid-item-box" @click="jumpFun('/pages/work/costManage/evectionApply')">
							<image style="height: 80rpx;width: 80rpx;" src="/static/images/icon/icon2.png" alt="" />
							<text class="text">出差申请</text>
						</view>
					</uni-grid-item>
					<uni-grid-item>
						<view class="grid-item-box">
							<image style="height: 80rpx;width: 80rpx;" src="/static/images/icon/icon3.png" alt="" />
							<text class="text">费用申请</text>
						</view>
					</uni-grid-item>
					<uni-grid-item>
						<view class="grid-item-box">
							<image style="height: 80rpx;width: 80rpx;" src="/static/images/icon/icon4.png" alt="" />
							<text class="text">差旅报销</text>
						</view>
					</uni-grid-item>
					<uni-grid-item>
						<view class="grid-item-box">
							<image style="height: 80rpx;width: 80rpx;" src="/static/images/icon/icon5.png" alt="" />
							<text class="text">费用报销</text>
						</view>
					</uni-grid-item>
				</uni-grid>
			</view>
		</view>
		<view class="content-item">
			<uni-section title="车辆管理" type="line"></uni-section>
			<view class="grid-body">
				<uni-grid :column="column" :showBorder="false" @change="changeGrid">
					<uni-grid-item>
						<view class="grid-item-box">
							<image style="height: 70rpx;width: 80rpx;" src="/static/images/icon/icon6.png" alt="" />
							<text class="text">用还车申请</text>
						</view>
					</uni-grid-item>
				</uni-grid>
			</view>
		</view>
		<view class="content-item">
			<uni-section title="行政办公" type="line"></uni-section>
			<view class="grid-body">
				<uni-grid :column="column" :showBorder="false" @change="changeGrid">
					<uni-grid-item>
						<view class="grid-item-box">
							<image style="height: 80rpx;width: 80rpx;" src="/static/images/icon/icon7.png" alt="" />
							<text class="text">请假单</text>
						</view>
					</uni-grid-item>
					<uni-grid-item>
						<view class="grid-item-box">
							<image style="height: 80rpx;width: 80rpx;" src="/static/images/icon/icon8.png" alt="" />
							<text class="text">加班申请单</text>
						</view>
					</uni-grid-item>
					<uni-grid-item>
						<view class="grid-item-box">
							<image style="height: 80rpx;width: 80rpx;" src="/static/images/icon/icon9.png" alt="" />
							<text class="text">外出申请单</text>
						</view>
					</uni-grid-item>
					<uni-grid-item>
						<view class="grid-item-box">
							<image style="height: 80rpx;width: 80rpx;" src="/static/images/icon/icon10.png" alt="" />
							<text class="text">补卡申请单</text>
						</view>
					</uni-grid-item>

					<uni-grid-item>
						<view class="grid-item-box">
							<image style="height: 80rpx;width: 80rpx;" src="/static/images/icon/icon11.png" alt="" />
							<text class="text">招聘需求</text>
						</view>
					</uni-grid-item>

					<uni-grid-item>
						<view class="grid-item-box">
							<image style="height: 80rpx;width: 80rpx;" src="/static/images/icon/icon12.png" alt="" />
							<text class="text">其他申请</text>
						</view>
					</uni-grid-item>
				</uni-grid>
				<uni-grid-item>
					<view class="grid-item-box">
						<uni-icons type="wallet-filled" size="24"></uni-icons>
						<text class="text">会议预约</text>
					</view>
				</uni-grid-item>
				</uni-grid>
			</view>
		</view> -->
	</view>
</template>

<script>
	export default {
		data() {
			return {
				column: 5,
				current: 0,
				swiperDotIndex: 0,
				getWorkTabs: getWorkTabs,
				data: [{
						image: '/static/images/banner/banner01.jpg'
					},
					{
						image: '/static/images/banner/banner02.jpg'
					},
					{
						image: '/static/images/banner/banner03.jpg'
					}
				]
			}
		},
		methods: {
			jumpFun(url) {
				// console.log('111111111');
				this.$jump.navigateTo(url)
			},
			clickBannerItem(item) {
				console.info(item)
			},
			changeSwiper(e) {
				this.current = e.detail.current
			},
			changeGrid(e) {
				// this.$modal.showToast('模块建设中~')
			}
		}
	}
</script>

<style lang="scss" scoped>
	* {
		box-sizing: border-box;
	}

	.work-container {
		background-color: #F2F1F6;
	}

	.content-item {
		background-color: #fff;
		margin: 15rpx 20rpx;
		border-radius: 20rpx;
		overflow: hidden;

		::v-deep .uni-grid {
			// 	background-color: red !important;
		}
	}

	::v-deep .uni-section__content-title {
		&>span {
			font-weight: 600;
			// color: #0081FF
		}
	}

	.grid-item-box {
		padding-top: 0 !important;
	}

	page {
		display: flex;
		flex-direction: column;
		box-sizing: border-box;
		background-color: #fff;
		min-height: 100%;
		height: auto;
	}

	view {
		font-size: 28rpx;
		line-height: inherit;
	}


	.text {
		text-align: center;
		font-size: 26rpx;
		margin-top: 10rpx;
	}

	.grid-item-box {
		flex: 1;
		/* #ifndef APP-NVUE */
		display: flex;
		/* #endif */
		flex-direction: column;
		align-items: center;
		justify-content: center;
		padding: 30rpx 0;
	}

	.uni-margin-wrap {
		width: 690rpx;
		width: 100%;
		;
	}

	.swiper {
		height: 300rpx;
	}

	.swiper-box {
		height: 300rpx;
	}

	.swiper-item {
		/* #ifndef APP-NVUE */
		display: flex;
		/* #endif */
		flex-direction: column;
		justify-content: center;
		align-items: center;
		color: #fff;
		height: 300rpx;
		line-height: 300rpx;
	}

	.uni-swiper-dot-box {
		padding: 10rpx 20rpx;

		.swiper-item {
			border-radius: 20rpx;
			overflow: hidden;
		}
	}

	@media screen and (min-width: 1000rpx) {
		.uni-swiper-dot-box {
			width: 800rpx;
			/* #ifndef APP-NVUE */
			margin: 0 auto;
			/* #endif */
			margin-top: 16rpx;
		}

		.image {
			width: 100%;
		}
	}
</style>